package pong.app.controllers 
{
	import common.IStateController;
	import pong.app.IPongAppState;
	import pong.app.IPongAppStateContext;
	/**
	 * ...
	 * @author Luke Van In
	 */
	public class __PongAppStateContext implements IPongAppStateContext
	{
		
		private var _loadingState:IPongAppState;
		
		private var _menuState:IPongAppState;
		
		private var _loginState:IPongAppState;
		
		private var _gameState:IPongAppState;
		
		private var _scoresState:IPongAppState;
		
		private var _stateController:IStateController
		
		
		public function PongAppStateContext(stateController:IStateController, loadingState:IPongAppState, menuState:IPongAppState, loginState:IPongAppState, gameState:IPongAppState, scoresState:IPongAppState) 
		{
			this._stateController = stateController;
			
			this._loadingState = loadingState;
			
			this._menuState = menuState;
			
			this._loginState = loginState;
			
			this._gameState = gameState;
			
			this._scoresState = scoresState;			
		}
		

		
		public function isLoadingState():Boolean 
		{
			return (this.getCurrentState() == this._loadingState);
		}
		
		
		public function isMenuState():Boolean 
		{
			return (this.getCurrentState() == this._menuState);
		}
		
		
		public function isLoginState():Boolean 
		{
			return (this.getCurrentState() == this._loginState);
		}
		
		
		public function isGameState():Boolean 
		{
			return (this.getCurrentState() == this._gameState);
		}
		
		
		public function isScoresState():Boolean 
		{
			return (this.getCurrentState() == this._scoresState);
		}
		
		
		
		public function gotoLoadingState():void 
		{
			this._stateController.gotoState(this._loadingState);
		}
		
		
		public function gotoMenuState():void 
		{
			this._stateController.gotoState(this._menuState);
		}
		
		
		public function gotoLoginState():void 
		{
			this._stateController.gotoState(this._loginState);
		}
		
		
		public function gotoGameState():void 
		{
			this._stateController.gotoState(this._gameState);
		}
		
		
		public function gotoScoresState():void 
		{
			this._stateController.gotoState(this._scoresState);
		}
		
		
		
		public function getCurrentState():IPongAppState
		{
			return this._stateController.currentState as IPongAppState;
		}
		
	}

}